package com.situ.mall.common.mapper;

import com.situ.mall.common.entity.Member;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lwj
 * @since 2023-09-21
 */
public interface MemberMapper extends BaseMapper<Member> {


    List<Member> list(String username, String status);

    @Update("update member set  password = '123456' ")
    void resetPassword(String[] ids);

    int updateAll(String[] ids);

    @Update("update member set username = #{username}, tel = #{tel}, sex = #{sex},email=#{email} where id = #{id}")
    void updateInformation(String username, String tel, String sex, String email,Integer id);

    @Update("update member set password = #{newpassword1} where id = #{id}")
    void updatePassword(String newpassword1, Integer id);

    @Select("select * from member where tel = #{tel}")
    Member selectByTel(String tel);
    @Insert("insert into member(username, password, tel) VALUE (#{tel},#{password},#{tel})")
    void register(String tel, String password);

    @Select("select * from member where id = #{id}")
    List<Member> selectAvatarById(Integer id);
}
